import java.util.Scanner;


public class palindromeAss 
{
	public static void main(String[] args) 
	{
		Scanner s = new Scanner(System.in);
		System.out.println("Enter the size of the list :Default is 5");
		
		int size =5;
		
		try
		{
			size = s.nextInt();
		}
		catch(Exception e)
		{
			size =5;
			s= new Scanner(System.in);
			System.out.println("Default size is set as 5:"+e+"\n");
		}
		
		System.out.println("Enter the number to be sorted:");
					
		int array[] = new int[size];
		int i=0;
		
		while(i<size)
		{
			try
			{
				array[i] = s.nextInt();
				i++;					
			}
			catch(Exception e)
			{
				System.out.println("Invalid value entered:"+e);
				s = new Scanner(System.in);
			}
		}

		// palindrome checking starts here
		palindromeAss obj = new palindromeAss();
		boolean flag = true;
		for (i=0;i<size;i++)
		{
			flag = obj.palMethod(array[i]);
			if(flag)
				System.out.println("\n"+array[i]+" is a palindrome");
			else
				System.out.println("\n"+array[i]+" is not a palindrome");
		}

	}
	public boolean palMethod(int n)
	{
		StringBuilder sb = new StringBuilder();
		sb.append("");
		sb.append(n);
		String temp = sb.toString();
		String reverse =  new StringBuffer(temp).reverse().toString();
		
		if ((temp.compareTo(reverse)) == 0)
		{
			return true;
		}
		else
			return false;
	}
}
